super(), __init__?
A diagram representing a class at the top and object instances created from the class
A parent class (green) and two different child classes (blue and orange), each with objects created from them
df = pd.DataFrame(data) <– Instantiating a dataframe objectdf.head(), df.describe(), df.drop() <– calling methodsSeparating the implementation code from the functionality that users (i.e. other programmers) interact with
Creates a simple interface for parts of a program pass information between each other
Examples:
When you want to easily re-use code, to avoid repetition and to extend functionality
When you want to model real-world entities
When you want to make code modular and easy for others to work with
When you want to simplify end-users’ interaction with Python, fostering a self-service approach to analytics
Less appropriate for: When you want to be certain of the state of your data at each step of a process, for example when cleansing data
Discrete Event Simulations for modelling queueing / capacity problems
Creating custom, branded visualisation packages, for example an NHS-branded SPC chart
Creating a package that can be used to import the latest data from a website without users having to understand API calls or the website’s structure
RealPython: Object-Oriented Programming (OOP) in Python
OOP produces code that is easy to read, extend and maintain
HSMA’s Guide to Object-Oriented Programming
HSMA’s Discrete Event Simulation Module
Contact:
Notebook & Slides:
… And don’t forget to give us your feedback.
Specialist Analytics Team // Object-Oriented Programming // August 28, 2025